<?php
declare(strict_types=1);

namespace Modules\Inventory\Http\Controllers;

use Catch\Base\CatchController as Controller;
use Modules\Inventory\Http\Requests\InventoryPlanRequest;use Modules\Inventory\Models\InventoryOrder;
use Illuminate\Http\Request;use Modules\Inventory\Repository\InventoryOrderRepository;use Modules\Inventory\Repository\InventoryPlanRepository;


class InventoryOrderController extends Controller
{
    public function __construct(
        protected readonly InventoryOrder $model
    ){}

    /**
     * 盘点单列表
     * @param Request $request
     * @return mixed
     */
    public function index(Request $request): mixed
    {
        return InventoryOrderRepository::getList($request->all());
    }

    /**
     * @param Request $request
     * @return mixed
     */
    public function store(Request $request)
    {
        return $this->model->storeBy($request->all());
    }

    /**
     * @param $id
     * @return mixed
     */
    public function show($id)
    {
        return $this->model->firstBy($id);
    }

    /**
     * @param Request $request
     * @param $id
     * @return mixed
     */
    public function update($id, Request $request)
    {
        return $this->model->updateBy($id, $request->all());
    }

    /**
     * @param $id
     * @return mixed
     */
    public function destroy($id)
    {
        return $this->model->deleteBy($id);
    }
}
